function DX(n) {
	if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n))
		return "数据非法";
	if (n == 0.0)
		return "零元零角零分";
	var unit = "亿万仟佰拾亿万仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
	n += "00";
	var p = n.indexOf('.');
	if (p >= 0)
		n = n.substring(0, p) + n.substr(p + 1, 2);
	unit = unit.substr(unit.length - n.length);
	for (var i = 0; i < n.length; i++)
		str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
	return str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(
			/零(万|亿|元)/g, "$1").replace(/(亿)万|零(拾)/g, "$1$2").replace(
			/^元零?|零分/g, "").replace(/元$/g, "元整");
}

function resetImage(canvas, imageUrl,callback) {
	if (!window.img) {
		window.img = new Image();
		window.img.src = imageUrl;
	}

	var context = canvas.getContext("2d");
	if (!context.fillText) {
		context.measureText = function(textToDraw) {
			var hiddenSpan = document.createElement('span');
			hiddenSpan.style.font = this.font;
			hiddenSpan.innerHTML = textToDraw;
			var bodyNode = document.getElementsByTagName("body")[0];
			bodyNode.appendChild(hiddenSpan);
			var width = hiddenSpan.offsetWidth;
			bodyNode.removeChild(hiddenSpan);
			return {
				"width" : width + 1
			};
		}
		context.fillText = function(textToDraw, x, y) {
			var vmlStr = [];
			var textHeightStr = this.font.split("px")[0].replace(
					/(^\s+)|(\s+$)/g, "").split(" ");
			textHeightStr = textHeightStr[textHeightStr.length - 1];
			var textHeight = /^\d+$/.test(textHeightStr) ? parseInt(textHeightStr)
					: 16;
			vmlStr.push('<g_vml_:shape style="font:' + this.font + ';',
					' color:' + this.fillStyle + ';', ' position:absolute;',
					' left:' + x + 'px;', ' top:' + (y - textHeight) + 'px;',
					' width:' + this.measureText(textToDraw).width + 'px;',
					' height:' + (textHeight + 4) + 'px;"',
					' ><g_vml_:textbox inset="0,0,0,0">' + textToDraw,
					' </g_vml_:textbox>', '</g_vml_:shape>');

			this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));
		}
	}
	context.clearRect(0, 0, canvas.get("width"), canvas.get("height"));
	if(window.img._loaded){
		context.drawImage(window.img, 0, 0, canvas.get("width"), canvas
				.get("height"));
		callback();
	}else{
		window.img.onload=function(){
			window.img._loaded = true;
			context.drawImage(window.img, 0, 0, canvas.get("width"), canvas
					.get("height"));
			callback();
		}
	}


}

function drawTick(canvas, x, y) {
	var context = canvas.getContext("2d");
	context.beginPath();
	context.lineWidth = 2;
	context.strokeStyle = "#000";
	context.moveTo(x - 3, y - 5);
	context.lineTo(x, y);
	context.lineTo(x + 7, y - 7);
	context.stroke();
	context.closePath();
}